/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.autosalon.ui.customer.action;

import com.autosalon.DAO.DaoFactory;
import com.autosalon.model.Zakaznik;
import com.autosalon.ui.customer.Customer;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Window.Notification;

/**
 *
 * @author Kubík
 */
public class DeleteCustomerAction extends AbstractCustomerAction {

    public DeleteCustomerAction(Customer customer) {
        super(customer);
    }

	@Override
	public void buttonClick(ClickEvent event) {
        Zakaznik zakaznik = (Zakaznik) DaoFactory.getinstance().getZakaznik().getById(Long.parseLong(event.getButton().getData().toString()));
        DaoFactory.getinstance().getZakaznik().delete(zakaznik);
        customer.getWindow().showNotification("Smazání zákazníka proběhlo úspěšně.", Notification.TYPE_WARNING_MESSAGE);
    }


}
